import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/element.js'

import './assets/css/global.css'
//进度条
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

import axios from 'axios'
// axios.defaults.baseURL = 'https://www.liulongbin.top:8888/api/private/v1/'
axios.defaults.baseURL = 'https://www.lianghj.top:8888/api/private/v1/'

// 在 request 拦截器中，展示进度条 NProgress.start()
axios.interceptors.request.use(config => {
  // Do something before request is sent
  NProgress.start()
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config;
}, error => {
  // Do something with request error
  return Promise.reject(error);
});
// 在 response 拦截器中，隐藏进度条 NProgress.done()
axios.interceptors.response.use(response => {
  NProgress.done()
  // Do something before response is sent
  return response;
});

Vue.prototype.$http = axios

Vue.config.productionTip = false


import TreeTable from 'vue-table-with-tree-grid'

Vue.component('tree-table', TreeTable)
// 时间
import moment from 'moment'     //导入
Vue.filter('moment', function (value, formatString) {
  formatString = formatString || 'YYYY-MM-DD HH:mm:ss';
  // return moment(value).format(formatString); // value可以是普通日期 20170723
  return moment.unix(value).format(formatString); // 这是时间戳转时间
});

import VueQuillEditor from 'vue-quill-editor'
import 'quill/dist/quill.core.css' // import styles
import 'quill/dist/quill.snow.css' // for snow theme
import 'quill/dist/quill.bubble.css' // for bubble theme
Vue.use(VueQuillEditor)

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

